package com.learn.util;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.learn.interceptor.AuthenticationInterceptor;
import com.learn.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @description: 描述
 * @author: Mr.Hu
 * @create: 2022/3/16 22:10
 **/
@Component
public class TokenUtil {

    public String getToken(User user) {
        String token = "";
        token = JWT.create().withAudience(String.valueOf(user.getUserID()))
                .sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }
}
